package ru.paswd.marketprice.helpers

import android.content.Context
import android.view.View
import com.yandex.mapkit.MapKitFactory
import com.yandex.mapkit.mapview.MapView

object YandexMapHelper {
    private var initialized = false

    fun init(context: Context, apiKey: String) {
        if (initialized) {
            return
        }

        MapKitFactory.setApiKey(apiKey)
        MapKitFactory.initialize(context)

        initialized = true
    }

    fun onStart(view: MapView) {
        view.onStart()
        MapKitFactory.getInstance().onStart()
    }

    fun onStop(view: MapView) {
        view.onStop()
        MapKitFactory.getInstance().onStop()
    }
}